//package com.example.config.tag;
//
//import org.beetl.core.resource.ClasspathResourceLoader;
//import org.beetl.core.tag.TagFactory;
//import org.beetl.ext.spring.BeetlGroupUtilConfiguration;
//import org.beetl.ext.spring.BeetlSpringViewResolver;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import java.util.Map;
//
///**
// * @author Jiamingzhen
// * @Date 2021/4/27 15:16
// * @ClassName BeetlTemplateConfig
// * @Introduce Beetl配置类
// */
//@Configuration
//public class BeetlTemplateConfig {
//    @Value("${spring.mvc.view.prefix}")
//    String templatesPath;// 模板跟目录
//    /**
//     * beetl的配置
//     */
//    @Bean(initMethod = "init",name = "beetlConfig")
//    public BeetlGroupUtilConfiguration getBeetlGroupUtilConfiguration(@Qualifier(value = "tagFactorys") Map<String, TagFactory> tagFactorys) {
//        BeetlGroupUtilConfiguration beetlGroupUtilConfiguration = new BeetlGroupUtilConfiguration();
//        //获取Spring Boot 的ClassLoader
//        ClassLoader loader = Thread.currentThread().getContextClassLoader();
//        if(loader==null){
//            loader = BeetlTemplateConfig.class.getClassLoader();
//        }
//        ClasspathResourceLoader cploder = new ClasspathResourceLoader(loader,
//                templatesPath);
//        beetlGroupUtilConfiguration.setResourceLoader(cploder);
//        beetlGroupUtilConfiguration.init();
//        beetlGroupUtilConfiguration.setTagFactorys(tagFactorys);
//        //如果使用了优化编译器，涉及到字节码操作，需要添加ClassLoader
//        beetlGroupUtilConfiguration.getGroupTemplate().setClassLoader(loader);
//        return beetlGroupUtilConfiguration;
//
//    }
//
//
//
//
//    @Bean(name = "beetlViewResolver")
//    public BeetlSpringViewResolver getBeetlSpringViewResolver(@Qualifier("beetlConfig") BeetlGroupUtilConfiguration beetlGroupUtilConfiguration) {
//        BeetlSpringViewResolver beetlSpringViewResolver = new BeetlSpringViewResolver();
////        beetlSpringViewResolver.setPrefix("WEB-INF/views/");
//        beetlSpringViewResolver.setSuffix(".html");
//        beetlSpringViewResolver.setContentType("text/html;charset=UTF-8");
//        beetlSpringViewResolver.setOrder(0);
//        beetlSpringViewResolver.setConfig(beetlGroupUtilConfiguration);
//        return beetlSpringViewResolver;
//    }
//}
